﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Templates/Acuicultura.Master" AutoEventWireup="true" CodeBehind="frmMateria.aspx.cs" Inherits="EstadisticaProduce.Acuicultura.frmMateria" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 <div class="clsDivResultado" style="margin: auto;">
 <script type="text/javascript">
     $(document).ready(function () {
         $("#<%=txtValor.ClientID %>").ForceNumericOnly();
         $("#<%=txtTM.ClientID %>").ForceNumericOnly();
     }); 
    </script>
  <script type="text/javascript">
      $(function () {
          InitializeDeleteConfirmation();

      });

      function InitializeDeleteConfirmation() {
          $('#deleteConfirmationDialog').dialog({
              autoOpen: false,
              resizable: false,
              height: 120,
              modal: true,
              buttons: {
                  "Delete": function () {
                      $(this).dialog("close");
                      $(this).css("font-size:10px")
                  },
                  Cancel: function () {
                      $(this).dialog("close");
                  }
              }
          });
      }

      function deleteItem(uniqueID, itemID) {
          var dialogTitle = 'Eliminar registro ' + itemID + '?';

          $("#deleteConfirmationDialog").html('<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Por favor confirme la eliminación del Registro</p>');

          $("#deleteConfirmationDialog").dialog({
              title: dialogTitle,
              buttons: {
                  "Eliminar": function () { __doPostBack(uniqueID, ''); $(this).dialog("close"); },
                  "Cancelar": function () { $(this).dialog("close"); }
              }
          });

          $('#deleteConfirmationDialog').dialog('open');
          return false;
      }

      function ShowError(errorMessage) {
          $(document).ready(function () {
              $("#deleteErrorDialog").text(errorMessage);
              $("#deleteErrorDialog").dialog({
                  modal: true,
                  buttons: {
                      Ok: function () {
                          $(this).dialog("close");
                          $(this).css("font-size", 11);
                      }
                  }
              });
          });
      }
    </script>
    <div id="deleteConfirmationDialog" style="font-size: 10px;"></div>
    <div id="deleteErrorDialog" title="Ocurrio un error, verifique." style="font-size: 10px;"></div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:HiddenField ID="hdnaccion" runat="server" />
            <asp:HiddenField ID="hdncodempresa" runat="server" />
            <asp:HiddenField ID="hdncodestablecimiento" runat="server" />
            <asp:HiddenField ID="hdncodregistro" runat="server" />
            <asp:HiddenField ID="hdnperiodo" runat="server" />
            <table class="clsTablaForm">
                <tr>
                    <td colspan="2">
                     <h2 class="abajo15 border-bottom">
                     Materia Prima</h2>
                        </td>
                </tr>
                <tr>
                    <td>
                        Especie</td>
                    <td>
                     <div class="styled-select">
                        <asp:DropDownList ID="ddlEspecie" runat="server" CssClass="especie">
                        </asp:DropDownList>
                      </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        Observación</td>
                    <td>
                        <asp:TextBox ID="txtObservacion" runat="server" TextMode="MultiLine" Width="400px" 
                            CssClass="inputText" MaxLength="100"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        TM</td>
                    <td>
                        <asp:TextBox ID="txtTM" runat="server" CssClass="valor inputText">0.00</asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Valor S/.</td>
                    <td>
                        <asp:TextBox ID="txtValor" runat="server" CssClass="valor inputText">0.00</asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Puerto</td>
                    <td>
                    <div class="styled-select">
                        <asp:DropDownList ID="ddlPuerto" runat="server" CssClass="especie">
                        </asp:DropDownList>
                    </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        Importado</td>
                    <td>
                        <asp:TextBox ID="txtImportado" runat="server" Width="400px" 
                            CssClass="inputText" ></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                       </td>
                    <td>
                       </td>
                </tr>
                <tr>
                    <td colspan="2">
                    <div class="contentButton">
                        <asp:Button ID="btnGrabar" runat="server" Text="Grabar" 
                            CssClass="boton button-small" onclick="btnGrabar_Click" />
                        <asp:Button ID="btnLimpia" CssClass="button-small p3" runat="server" 
                            Text="Limpiar" onclick="btnLimpia_Click"/>
                     </div>
                    </td>
                </tr>
            </table>
            <asp:GridView ID="gvRegistro" runat="server" AllowPaging="false" AllowSorting="false"
                    AutoGenerateColumns="false" CssClass="clsTabla" OnRowCommand="gvRegistro_RowCommand"
                    DataKeyNames="cod_registroproduccion,codperiodo,codempresa,nombrecomercial,desespeci,codespecie,canvolumen,numvolumen,valvolumen,codpuerto,despuerto,desobservacion">
                    <Columns>
                        <asp:TemplateField HeaderText="Nro.">
                            <ItemTemplate>
                                <%#Convert.ToInt32(DataBinder.Eval(Container, "DataItemIndex")) + 1%>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="30px" />
                            <HeaderStyle CssClass="cl_cab_busca" ForeColor="#ffffff" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="cod_materiaprima" HeaderText="cod_materiaprima">
                            <ItemStyle CssClass="hiddencol" />
                            <HeaderStyle CssClass="hiddencol" />
                        </asp:BoundField>
                        <asp:BoundField DataField="codperiodo" HeaderText="Periodo">
                            <ItemStyle CssClass="hiddencols" />
                            <HeaderStyle CssClass="hiddencols" />
                        </asp:BoundField>
                        <asp:BoundField DataField="nombrecomercial" HeaderText="Empresa">
                            <ItemStyle CssClass="hiddencols" />
                            <HeaderStyle CssClass="hiddencols" />
                        </asp:BoundField>
                        <asp:BoundField DataField="desespeci" HeaderText="Especie">
                            <ItemStyle CssClass="hiddencols" />
                            <HeaderStyle CssClass="hiddencols" Width="150px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="canvolumen" HeaderText="TM" DataFormatString="{0:N2}">
                            <ItemStyle CssClass="hiddencols" HorizontalAlign="Right" />
                            <HeaderStyle CssClass="hiddencols" Width="70px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="valvolumen" HeaderText="Volumen" DataFormatString="{0:N2}">
                            <ItemStyle CssClass="hiddencols" HorizontalAlign="Right" />
                            <HeaderStyle CssClass="hiddencols" Width="70px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="despuerto" HeaderText="Puerto">
                            <ItemStyle CssClass="hiddencols" />
                            <HeaderStyle CssClass="hiddencols" />
                        </asp:BoundField>
                        <asp:BoundField DataField="desobservacion" HeaderText="Observación">
                            <ItemStyle CssClass="hiddencols" />
                            <HeaderStyle CssClass="hiddencols" />
                        </asp:BoundField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ID="ibtEditar" runat="server" CommandName="x_edit" ToolTip="Modificar"
                                    ImageUrl="~/Imagenes/Iconos/editrow16.png" />
                                <asp:ImageButton ID="ibt_delete" runat="server" CommandName="x_delete" ToolTip="Eliminar"
                                    ImageUrl="~/Imagenes/Iconos/trash16.png" OnClientClick="javascript:return deleteItem(this.name, this.alt);" />
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="40px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                    <RowStyle CssClass="RowStyle" />
                    <HeaderStyle CssClass="HeaderStyle" />
                    <AlternatingRowStyle CssClass="AlternatingRowStyle" />
                </asp:GridView>
                <asp:Panel  ID="pnlMensaje" runat="server" Visible="false" Style="padding-top: 30px;
                            border: dotted 1px #222; width: 700px; margin: auto; height: 60px; font-size: medium;
                            color: #3c9fff; font-weight: bold; text-align: center;">
                <asp:Label ID="lblMensaje" runat="server" />
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
  </div>
</asp:Content>
